Skip to content

fix: improve local command discovery - #36

Merged
chaim0m merged 3 commits into
mainfrom
codex/dci-local-version-command
Aug 3, 2026
Merged

fix: improve local command discovery#36
chaim0m merged 3 commits into
mainfrom
codex/dci-local-version-command

Conversation

@chaim0m

@chaim0m chaim0m commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • make dci version a first-class local command
  • print the embedded CLI version without trying to resolve version as an API hostname
  • keep root help, unknown-command behavior, and the embedded skill unchanged

Test methods

Automated validation run on this branch:

go test ./...
go vet ./...

Manual validation:

go build -o /tmp/dci-pr36 .
/tmp/dci-pr36 version
/tmp/dci-pr36 --version
/tmp/dci-pr36 --help

version and --version should print the same local version without making a network request. Root help should retain the existing complete command behavior.

Could this break things?

Risk: low. This only reserves version as a local command, matching the already-supported --version behavior. API commands, root help, unknown-command handling, and the embedded agent skill are unchanged. Only an unusual workflow that intentionally used version as an API host token would behave differently.

@chaim0m
chaim0m marked this pull request as ready for review August 2, 2026 13:38
@chaim0m
chaim0m requested a review from apgiorgi as a code owner August 2, 2026 13:38
@chaim0m chaim0m changed the title fix: handle version as a local command fix: improve local command discovery Aug 2, 2026
@chaim0m
chaim0m changed the base branch from main to codex/dci-command-safety August 2, 2026 13:56
@chaim0m
chaim0m force-pushed the codex/dci-command-safety branch from 6f2cbb4 to 8f765db Compare August 2, 2026 14:21
@chaim0m
chaim0m force-pushed the codex/dci-local-version-command branch from fa8a4be to 225b213 Compare August 2, 2026 14:24
@chaim0m
chaim0m changed the base branch from codex/dci-command-safety to main August 2, 2026 14:24
@chaim0m chaim0m self-assigned this Aug 3, 2026
@apgiorgi

apgiorgi commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Reviewed at 0a141f8. Built the branch and tested against the live API.

This looks good to merge. Dropping the help rewrite was the right call — it's now +28/-0 across two files, one focused change.

Confirmed the bug is real on main:

$ ./dci-main version
ERROR: Caught error: Get "https://version?customerContext=<active-context>": dial tcp: lookup version: no such host
EXIT=1

Worth noting for the changelog: this wasn't only a failed lookup — main also appended the active customer context as a query param to that arbitrary host. Good thing to have closed.

Verified on the branch: dci versiondev, exit 0, no network. Root help is unchanged (257 lines vs 256 on main), go build/vet/test all clean.

Two non-blocking notes:

  1. Two formats for one fact. dci version prints dev while dci --version prints <binary> version dev. Worth picking one. Also registerVersionCommand writes to os.Stdout directly where the surrounding registrations use cmd.OutOrStdout()/cli.Stdout.

  2. This is a point fix, not the root cause. The underlying hole is main.go:381's exemption list combined with restish's generic root Run treating args[0] as a hostname. Still open after this PR: dci ""Get "https:?customerContext=<ctx>", exit 1. Overriding cli.Root.Args/Run in lockToDCI() would close the whole class. Fine as a follow-up — not a reason to hold this.

@chaim0m
chaim0m merged commit 1e75fef into main Aug 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants